package com.example.dllo.my36kr.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * tabLayout的适配器
 * Created by CPC_272 on 16/8/15.
 */
public class MainTabAdapter extends FragmentPagerAdapter {
    private List<Fragment> datas;
    private ArrayList<String>titleList;

    public MainTabAdapter(FragmentManager fm, List<Fragment> datas) {
        super(fm);
        this.datas = datas;
        titleList=new ArrayList<>();
        titleList.add("新闻");
        titleList.add("股权投资");
        titleList.add("发现");
        titleList.add("消息");
        titleList.add("我的");
    }


    @Override
    public Fragment getItem(int position) {
        return datas.get(position);
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titleList.get(position);
    }
}
